<%@ page import="com.walkingfiles.registry.Document" %>
<%@ page import="com.walkingfiles.registry.LogItem" %>

<!doctype html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'document.log.label', default: 'Document Log')}" />
		<g:set var="documentEntityName" value="${message(code: 'document.label', default: 'Document')}" />
		<title><g:message code="default.show.label" args="[entityName]" /></title>
	</head>
	<body>
	<div id="outer">
		<g:render template="/layouts/menu"/>
		<a href="#show-documentLog" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
		<div id="show-documentLog" class="content scaffold-show" role="main">
			<h1><g:message code="default.show.label" args="[entityName]" /></h1>
			<g:if test="${flash.message}">
			<div class="message" role="status">${flash.message}</div>
			</g:if>
			
			<g:if test="${documentInstance?.log}">
				<br/>
				<g:each in="${LogItem.findAllByDocument(documentInstance, [sort: 'date', order: 'desc'])}" var="logItem">				    
				    <div class="change">
				        <h4><i><g:formatDate date="${logItem.date}" type="datetime" style="MEDIUM"/> ${logItem.user.username.encodeAsHTML()} en ${logItem.area.name.encodeAsHTML()}</i></h4>
				        ${logItem.xml}
				    </div>
				    <br/>
				</g:each>
			</g:if>
			<g:form>
				<fieldset class="buttons">
					<g:link class="show" controller="document" action="show" id="${documentInstance?.id}"><g:message code="default.show.label" args="[documentEntityName]"/></g:link>
				</fieldset>
			</g:form>
		</div>
	</div>
	</body>
</html>

